export function sessionSet(key, value) {
  // console.log(window.sessionStorage)
  let session = window.sessionStorage
  value = typeof value === 'object' ? JSON.stringify(value) : value
  session.setItem(key, value)
};
export function sessionGet(key) {
  let session = window.sessionStorage
  let value
  try {
    value = JSON.parse(session.getItem(key))
  } catch (error) {
    value = session.getItem(key)
  }
  return value
};

export function locationSet(key, value) {
  // console.log(window.sessionStorage)
  let localStorage = window.localStorage
  value = typeof value === 'object' ? JSON.stringify(value) : value
  localStorage.setItem(key, value)
};
export function locationGet(key) {
  let localStorage = window.localStorage
  let value
  try {
    value = JSON.parse(localStorage.getItem(key))
  } catch (error) {
    value = localStorage.getItem(key)
  }
  return value
};

export function sessionClean(key) {
  let session = window.sessionStorage
  session.removeItem(key);
};

export function locationClean(key) {
  let localStorage = window.localStorage
  localStorage.removeItem(key);
};
